<?php 	ob_start(); session_start(); include ("../config.inc.php"); ?>
<?php 
	
	date_default_timezone_set("Asia/Kuala_Lumpur");
	include ("../config/conn.php");
	$ad_check = 0;
	$user_check=0;
	$sid = session_id();
	$sql_check_session="SELECT session_username FROM session WHERE session_code='$sid'";
	$check_session=mysql_query($sql_check_session);
	$session=mysql_fetch_assoc($check_session);
	$id = $session['session_username'];
	$sql_check_su="SELECT ad_permission,ad_name FROM admin WHERE ad_no='$id'";
	$check_su=mysql_query($sql_check_su);
	$su=mysql_fetch_assoc($check_su);
	$who=$su['ad_name'];
	$ad_check=mysql_num_rows($check_session);
	if ($ad_check==1) {
		$id = $session['session_username'];
		$sql_get_name="SELECT ad_name FROM admin WHERE ad_no='$id'";
		$get_name=mysql_query($sql_get_name);
		$name=mysql_fetch_assoc($get_name);
		$who = $name['ad_name'];
	}
	if ($su['ad_permission']==1) {
			$ad_check=2;
	}
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>E-Learning System © : Admin Control Panel</title>
<link href="default.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	background-color: #000000;
	background-image: url("images/newstripe.png");
	background-repeat:repeat-xy;
}
-->
</style></head>
<body>
<div id="menu-wrap">
  <div id="menu">
    <ul>
		<li><a href="<?php echo get_server() . $location ."index.php"; ?>">Home</a></li>
		<li><a href="<?php echo get_server() . $location ."about_us.php"; ?>">About Us </a></li>
	  <?php if ($ad_check<1 && $user_check<1) { ?>
      	<li><a href="<?php echo get_server() . $location ."stud_reg.php"; ?>">Register </a></li>
      	<li><a href="<?php echo get_server() . $location ."login.php"; ?>">Login </a></li>
	  <?php } ?>
	  <?php if ( $ad_check >= 1 ) { ?>
		<li><a href="<?php echo get_server() . $location ."admin/admin.php"; ?>">Admin Control Panel </a></li>
	  <?php } ?>
    </ul>
  </div>
</div>
<div id="header">
</div><center>
<?php	if ($ad_check>0 || $user_check>0) {?>
  	<table width="780" border="0">
    <tr>
      <td width="634"><?php echo "&nbsp;&nbsp;<font color=\"red\">Welcome, <B>" .$who. "<B></font>";
	  ?></td>
      <td width="136" colspan="3"><div align="right"><?php echo "<a href=\"".$baseURL . $location . "logout.php\">Logout</a>&nbsp;&nbsp;"; ?></div></td> 
      
  </tr></table><?php } ?></center>